#ifndef _TIMER_H_
#define _TIMER_H_

#include <time.h>
#define MAX_TIMER_CNT 5

#define TIMEOUT_SEND_WINDOW 1 
#define TIMEOUT_RECV_WINDOW 1
#define TIMEOUT_RG_REQ 0 
#define TIMEOUT_RG_RESP 0

#define TIMEOUT_SEND_WINDOW_N 0 
#define TIMEOUT_RECV_WINDOW_N 0 
#define TIMEOUT_RG_REQ_N 10*1000000 
#define TIMEOUT_RG_RESP_N 10*1000000 

enum _rt_timer_t {		//the state set of timer
	SEND,
	SEND_WINDOW,
	RECV_WINDOW,		
	RG_REQ,
	RG_RESP
};
typedef enum _rt_timer_t rt_timer_t;

struct timespec delta_time(struct timespec start,struct  timespec end);
int timeout(rt_timer_t t);
void init_timer(rt_timer_t t,int send_rate);
void reset_timer(rt_timer_t t);




#endif
